package com.study.springmvc.v9mvc.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class MemberService {

    @Async
    public String save() {
        try {
            System.out.println("2. before save : " + Thread.currentThread().getName());
            Thread.sleep(5000);
            System.out.println("3. after save : " + Thread.currentThread().getName());
        }catch (Exception e) {

        }
        return "save";
    }

    public String update() {
        try {
            System.out.println("2. before update : " + Thread.currentThread().getName());
            Thread.sleep(5000);
            System.out.println("3. after update : " + Thread.currentThread().getName());
        }catch (Exception e) {

        }
        return "update";
    }

    public String insert() {
        try {
            System.out.println("2. before insert : " + Thread.currentThread().getName());
            Thread.sleep(5000);
            System.out.println("3. after insert : " + Thread.currentThread().getName());
        }catch (Exception e) {

        }
        return "insert";
    }
}

